package com.training.java.core.collections.car.post15;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import com.training.java.core.collections.car.pre15.CellPhone;

/**
 * @author Satya
 * 
 */
public class CellPhoneListDemo {

	public static void main(String[] args) {

		// Instantiating Multiple objects

		CellPhone cellPhone1 = new CellPhone("Apple", "iPhone3s", "iOS", 300);
		CellPhone cellPhone2 = new CellPhone("Samsung", "Nexus4", "Android OS",
				350);
		CellPhone cellPhone3 = new CellPhone("Sony", "Xperia", "Android OS",
				200);

		// Creating Set

		Set<CellPhone> listOfPhones = new HashSet<CellPhone>();
		// Adding objects to set

		listOfPhones.add(cellPhone1);
		listOfPhones.add(cellPhone2);
		listOfPhones.add(cellPhone3);
		listOfPhones.add(cellPhone3); // added duplicate

		// iterator
		for (CellPhone phones : listOfPhones) {

			System.out.println(" Cell  Company : " + phones.getCompany());
			System.out.println(" Cell   Model : " + phones.getModel());
			System.out.println(" Cell operatingSystem : "
					+ phones.getOperatingSystem());
			System.out.println(" Cell  Price  : " + phones.getPrice());
			System.out.println("************************");

		}
	}

}
